home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 2000
/
MacHack 2000.toast
/
pc
/
The Hacks
/
Softshoe
/
Lisa's Mac Parts
/
AppleEvents
/
Events
/
AEEvent.cp
< prev
next >
Wrap
Text File
|
2000-06-23
|
2KB
|
87 lines
// AEEvent.cp
#ifndef AEEvent_h
#include "AEEvent.h"
#endif
#ifndef OSError_h
#include "OSError.h"
#endif
#ifndef AEAddress_h
#include "AEAddress.h"
#endif
#include <Errors.h>
AEEvent::AEEvent( AEVerb verb,
const AEAddress& target )
{
ThrowOSError( AECreateAppleEvent( verb.Suite().Suite(),
verb.Event(),
&target,
kAutoGenerateReturnID,
kAnyTransactionID,
this ) );
}
AEEvent::AEEvent( AESuite suite,
AEEventID event,
const AEAddress& target )
{
ThrowOSError( AECreateAppleEvent( suite.Suite(),
event,
&target,
kAutoGenerateReturnID,
kAnyTransactionID,
this ) );
}
uint32 AEEvent::ParameterCount() const
{
Assert( !IsNull() );
int32 length;
ThrowOSError( AECountItems( this, &length ) );
Assert( length >= 0 );
return length;
}
bool AEEvent::MissedParameter() const
{
return Attribute( AEKey( keyMissedKeywordAttr ) ).Exists();
}
void AEEvent::ThrowMissedParameter() const
{
if ( MissedParameter() )
throw OSError( errAEParamMissed );
}
AEVerb AEEvent::Verb() const
{
AEEventClass suite;
Attribute( keyEventClassAttr ) >> Data( &suite, sizeof(suite) );
AEEventID event;
Attribute( keyEventIDAttr ) >> Data( &event, sizeof(event) );
return AEVerb( suite, event );
}
pascal Boolean AEEvent::IgnoreEvents( EventRecord *,
int32 *sleepTime,
RgnHandle *mouseRegion )
{
*sleepTime = 0x40000000;
*mouseRegion = 0;
return false;
}
AEIdleUPP AEEvent::IgnoreIncomingEvents()
{
#if GENERATINGCFM
static RoutineDescriptor IgnoreEvents =
BUILD_ROUTINE_DESCRIPTOR( uppAEIdleProcInfo, &AEEvent::IgnoreEvents );
#endif
return &IgnoreEvents;
}